#include <iostream>

class MyClass {
public:
    int myFunction(int a, int b) {
        return a + b;
    }
};

template<typename T>
int callFunction(T* obj, int (T::*func)(int, int), int a, int b) {
    return (obj->*func)(a, b);
}

int main() {
    MyClass obj;
    int (MyClass::*funcPtr)(int, int) = &MyClass::myFunction;

    int result = callFunction(&obj, funcPtr, 3, 4);

    std::cout << "Result: " << result << std::endl;

    return 0;
}
